home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / kernel / sources / kr_newpattern.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-25  |  14.0 KB  |  276 lines

  1. /*****************************************************************************
  2.   FILE           : kr_newpattern.h
  3.   SHORTNAME      : newpattern
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : handling of new pattern format
  7.   NOTES          : 
  8.  
  9.   AUTHOR         : Michael Vogt
  10.   DATE           : 10.9.93
  11.  
  12.   CHANGED BY     : 
  13.   IDENTIFICATION : @(#)kr_newpattern.h    1.3 3/15/94
  14.   SCCS VERSION   : 1.3
  15.   LAST CHANGE    : 3/15/94
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.  
  19. ******************************************************************************/
  20.  
  21. #ifndef _KR_NEWPATTERN_DEFINED_
  22. #define _KR_NEWPATTERN_DEFINED_
  23.  
  24.  
  25. /*****************************************************************************
  26.  FUNCTIONS WHICH ARE CALLED BY THE KERNEL USER INTERFACE TO PERFORM
  27.  THE KERNEL INTERFACE OF THE NEW PATTERN MANAGEMENT
  28. ******************************************************************************/
  29.  
  30. extern krui_err kr_npui_setCurrPatSet(int number);
  31. /*****************************************************************************
  32. determines the number of the current pattern set (in kernel terminology) 
  33. numbering starts with 0
  34. ******************************************************************************/
  35.  
  36. extern krui_err kr_npui_deletePatSet(int number);
  37. /*****************************************************************************
  38. deletes the specified pattern set from memory and undefines the
  39. current pattern set, pattern, training scheme and display scheme
  40. ******************************************************************************/
  41.  
  42. extern krui_err kr_npui_GetPatInfo(pattern_set_info *set_info, 
  43.                 pattern_descriptor *pat_info);
  44. /*****************************************************************************
  45. retrieves all available information concerning the current pattern set
  46. and the current pattern which both must be defined. The given
  47. parameter fields are filled with the information.
  48. ******************************************************************************/
  49.  
  50. extern krui_err kr_npui_DefShowSubPat(int *insize, int *outsize, 
  51.                    int *inpos, int *outpos);
  52. /*****************************************************************************
  53. Define the display scheme:
  54. Size and position of a sub pattern for the current pattern in the
  55. current pattern set is defined. <insize> is a pointer to an array of
  56. integer values which define the dimensional sizes of the input sub
  57. pattern. <inpos> is a pointer to an array of integer values which
  58. defines the offset (position) of this sub pattern inside the
  59. pattern. <outsize> and <outpos> are used to define the respective
  60. output sub pattern
  61. ******************************************************************************/
  62.  
  63. extern krui_err kr_npui_DefTrainSubPat(int *insize, int *outsize, 
  64.                 int *instep, int *outstep, int *max_n_pos);
  65. /*****************************************************************************
  66. Define the training scheme:
  67. Size and step size of sub pattern for the current pattern in the
  68. current pattern set is defined for training and testing. <insize> is a
  69. pointer to an array of integer values which define the dimensional
  70. sizes of the input sub pattern. <instep> is a pointer to an array of
  71. integer values which defines the step size which is used to move the
  72. sub pattern over the pattern.
  73. <outsize> and <outpos> are used to define the respective output sub
  74. pattern.
  75. <max_n_pos> (if not NULL) returns the number of valid input sub
  76. pattern positions for the current pattern and the given training
  77. scheme.
  78. ******************************************************************************/
  79.  
  80. extern krui_err kr_npui_AlignSubPat(int *inpos, int *outpos, int *no);
  81. /*****************************************************************************
  82. Align the position of a sub pattern:
  83. Using the current training scheme and the current pattern of the
  84. current pattern set, the given position of an input sub pattern
  85. <inpos> and the given position of the corresponding output sub pattern
  86. <outpos> is aligned to fit the currently defined training scheme.
  87. E.g. if the training scheme defines a step width of 5 for a specific
  88. dimension, only the positions 0, 5, 10, 15 ...  are valid positions
  89. for a sub pattern.
  90. The position of each dimension is aligned independently from all other
  91. dimensions by moving to the next valid position which is lower or
  92. equal to the given position.  <no> (if not NULL) returns the number of
  93. the sub pattern which corresponds to the new aligned position which is
  94. returned in place (<inpos> <outpos>).
  95. ******************************************************************************/
  96.  
  97. extern krui_err kr_npui_allocNewPatternSet(int *set_no);
  98. /*****************************************************************************
  99. Allocate an (additional) empty pattern set: A new pattern set is
  100. allocated if the maximum number of loaded pattern sets
  101. (NO_OF_PAT_SETS) is not exceeded. The corresponding pattern set handle
  102. is returned in <set_no>.  The new allocated pattern set becomes the
  103. current set.  There is no current pattern defined.  Training scheme
  104. and display scheme both become undefined.
  105. ******************************************************************************/
  106.  
  107. extern krui_err kr_npui_loadNewPatterns(char *filename, int *set_no);
  108. /*****************************************************************************
  109. Load an (additional) pattern file:
  110. The file with name <filename> is loaded into memory if existent and if
  111. the maximum number of loaded pattern sets (NO_OF_PAT_SETS) is not
  112. exceeded. The corresponding pattern set handle is returned in
  113. <set_no>.
  114. The new loaded pattern set becomes the current set. The first pattern
  115. inside this set becomes the current pattern. Training scheme and
  116. display scheme both become undefined.
  117. ******************************************************************************/
  118.  
  119. extern krui_err kr_npui_saveNewPatterns(char *filename, int set_no);
  120. /*****************************************************************************
  121. The given pattern set <set_no> is written to file <filename> in new
  122. style format. No side effects.
  123. ******************************************************************************/
  124.  
  125. extern krui_err kr_npui_GetShapeOfSubPat(int *insize, int *outsize, 
  126.                   int *inpos, int *outpos, int n_pos);
  127. /*****************************************************************************
  128. Get the shape of a sub pattern which is specified by a number:
  129. After kr_npui_DefTrainSubPat has been called for the current pattern
  130. set and a current pattern is defined, this function retrieves the
  131. <n_pos>th valid sub pattern pair which matches the defined training
  132. scheme. Size and position of the sub pattern pair is returned in
  133. <insize> <inpos> <outsize> and <outpos> which are all pointer to
  134. integer arrays.
  135. ******************************************************************************/
  136.  
  137. /*****************************************************************************
  138.  FUNCTIONS WHICH ARE CALLED BY OTHER KERNEL FUNCTIONS LIKE TRAINING
  139.  AND INITIALIZATION FUNCTIONS:
  140. ******************************************************************************/
  141.  
  142. extern int  kr_np_pattern(int mode ,int mode1 ,int pattern_no);
  143. /*****************************************************************************
  144. multiple pattern handling functions depending on mode and mode1
  145. *****************************************************************************/
  146.  
  147. extern krui_err kr_initSubPatternOrder(int start, int end);
  148. /*****************************************************************************
  149. The sub pattern ordering for the current pattern set is reset for the
  150. next training or initialization run. During this run all sub patterns
  151. from pattern <start> up to pattern <end> are generated according to
  152. current shuffle flags for patterns and sub patterns.
  153. kr_getSubPatByOrder is to be called to get the next sub pattern number
  154. during the run (see below)
  155. *****************************************************************************/
  156.  
  157. extern bool kr_getSubPatternByOrder(int *pattern, int *sub);
  158. /*****************************************************************************
  159. According to the last call to kr_initSubPatternOrder, the last call to
  160. this function and the shuffle flags, the next position of pattern and
  161. sub pattern is determined. This numbers are returned in <pattern> and
  162. <sub> (beginning with 0). If there are no more sub pattern avaliable
  163. the return value is FALSE, otherwise TRUE.
  164. *****************************************************************************/
  165.  
  166. extern bool kr_getSubPatternByNo(int *pattern, int *sub, int n);
  167. /*****************************************************************************
  168. According to the current pattern set, the position of the <n>th sub
  169. pattern is determined and returned in <pattern> (the pattern which
  170. includes the subpattern) and <sub> (the sub pattern inside the
  171. pattern) (beginning with 0). 
  172. This function does not effect the ordering of the function
  173. kr_getSubPatByOrder. <n> ranges from 0 to kr_TotalNoOfSubPatPairs()-1.
  174. If the sub pattern is available, TRUE is returned, otherwise FALSE.
  175. *****************************************************************************/
  176.  
  177. extern int kr_TotalNoOfSubPatPairs(void);
  178. /*****************************************************************************
  179. This function returns the total number of available sub patterns for
  180. the current pattern set or 0 if no pattern set is defined.
  181. The result is the sum of the numbers of subpattern for all patterns in
  182. the current set.
  183. *****************************************************************************/
  184.  
  185. extern int kr_NoOfSubPatPairs(int pattern);
  186. /*****************************************************************************
  187. This function returns the number of available sub patterns for the
  188. pattern <pattern> of the current pattern set or 0 if this pattern is
  189. not defined.
  190. *****************************************************************************/
  191.  
  192. extern int kr_AbsPosOfFirstSubPat(int pattern);
  193. /*****************************************************************************
  194. This function returns the absolute position of the first sub pattern
  195. of pattern <pattern> in the current pattern set. This position is
  196. defined as the Sum of kr_NoOfSubPatPairs(i) where i runs from 0 to
  197. <pattern>-1.
  198. The absolute position of the first sub pattern of pattern 0 is 0.
  199. The returned value may be used as argument for the function
  200. kr_getSubPatternByNo.
  201. *****************************************************************************/
  202.  
  203. extern int kr_TotalNoOfPattern(void);
  204. /*****************************************************************************
  205. This function returns the total number of available patterns for
  206. the current pattern set or 0 if no pattern set is defined.
  207. *****************************************************************************/
  208.  
  209. extern Patterns kr_getSubPatData(int pat_no, int sub_no, int io_type, 
  210.                  int *size);
  211. /*****************************************************************************
  212. For the current pattern set and the specified sub pattern size, the
  213. data array of the <sub_no>th sub pattern of the <pat_no>th pattern is
  214. returned. io_type spcifies whether the input (INPUT) or output
  215. (OUTPUT) data is requested. If <size> is != NULL the size of the data
  216. array is returned is this parameter.
  217. The function returns a pointer to the data array (type Patterns) or
  218. NULL if an error occured.
  219. *****************************************************************************/
  220.  
  221. extern int kr_SizeOfInputSubPat(void);
  222. /*****************************************************************************
  223. For the current pattern set and the specified sub pattern size, the size of 
  224. the input part of the first sub pattern of the first pattern is returned. 
  225. Negative return values indicate KernelErrorCode. Size 0 is a valid return value
  226. since the pattern may contain no data.
  227. *****************************************************************************/
  228.  
  229. extern int kr_SizeOfOutputSubPat(void);
  230. /*****************************************************************************
  231. For the current pattern set and the specified sub pattern size, the size of 
  232. the output part of the first sub pattern of the first pattern is returned. 
  233. Negative return values indicate KernelErrorCode. Size 0 is a valid return value
  234. since the pattern may contain no data.
  235. *****************************************************************************/
  236.  
  237. /*****************************************************************************
  238.  FUNCTIONS WHICH ARE CALLED BY THE PATTERN PARSER OR FROM INSIDE THIS
  239.  MODULE. DON'T USE THESE FUNCTIONS FOR OTHER PURPOSES !!!!!
  240. ******************************************************************************/
  241.  
  242. extern krui_err kr_np_AllocatePatternSet(int *pat_set, int number);
  243. /*****************************************************************************
  244. A new set of patterns with <number> number of patterns is defined. An
  245. internal pattern set number is assigned to reference this pattern set.
  246. It is returned in <pat_set>.
  247. ******************************************************************************/
  248.  
  249. extern krui_err kr_np_AllocatePattern(pattern_descriptor *pattern,
  250.                    bool input);
  251. /*****************************************************************************
  252. Depending on the entries input_dim, input_dim_sizes, input_fixsize resp.
  253. output_dim, output_dim_sizes, output_fixsize of the pattern descriptor
  254. <pattern> new memory for this pattern is allocated (input_pattern resp.
  255. output_pattern). input_info resp. output_info is set to (char *) NULL.
  256. The function allocates space for an input pattern if input is TRUE,
  257. output pattern otherwise.
  258. ******************************************************************************/
  259.  
  260. extern krui_err kr_np_GetDescriptor(int pat_set, int number, 
  261.                  pattern_descriptor **pattern);
  262. /*****************************************************************************
  263. A pointer to the pattern pattern descriptor of pattern <number> in
  264. pattern set <pat_set> is returned in <pattern>. The structure pattern
  265. must be provided by the calling routine. A call to this function makes
  266. the specified pattern to become the current pattern.  Return value:
  267. error status
  268. ******************************************************************************/
  269.  
  270.  
  271.  
  272.  
  273. #endif
  274.  
  275. /* 230 lines generated by deleteprivatedefinitions.awk */
  276.